import java.io.IOException;

import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;


/**
 * 
 * @author qichun(chunqi_sh@126.com)
 * @date Mar 1, 2013 10:59:58 AM
 */
public class PdfBox {

	public static void main(String[] args) throws IOException, COSVisitorException {
		PDDocument pdf = PDDocument.load("D:/111.pdf");
		PDDocumentCatalog docCatalog = pdf.getDocumentCatalog(); 
		PDAcroForm acroForm = docCatalog.getAcroForm(); 
		PDField field = acroForm.getField( "xyz" ); 
		field.setValue( "Smith" ); 
		pdf.save("D:/111.pdf");
	}

}
